import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/vue-admin-template/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
export function UpdateUser(username,password,newPassword,reNewPassword) {
  return request({
    url: '/vue-admin-template/user/UpdateUser',
    method: 'post',
    data:{
      username:username,
      password: password,
      newPassword:newPassword,
      reNewPassword:reNewPassword
    }
  })
}
export function updateInfo(username,name,introduction) {
  return request({
    url: '/vue-admin-template/user/updateInfo',
    method: 'post',
    data:{
      username:username,
      name: name,
      introduction:introduction
    }
  })
}
export function updateing(username,imageUrl) {
  return request({
    url: '/vue-admin-template/user/updateing',
    method: 'post',
    data:{
      username:username,
      avatar:imageUrl
    }
  })
}
// 用户分页列表
export function getUser(data) {
  return request({
    url: '/vue-admin-template/user/getPage',
    method: 'post',
    data:data
  })
}

// 更新用户
export function update(data) {
  return request({
    url: '/vue-admin-template/user/update',
    method: 'post',
    data:data
  })
}
